package com.jsb.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jsb.mapper.RedEnvelopesMapper;
import com.jsb.model.RedEnvelopes;
import com.jsb.model.RedEnvelopesExample;

@Service
public class RedEnvelopesService{
	
	@Resource
	private RedEnvelopesMapper redEnvelopesMapper;
	
	public void addRedEnvelopes(RedEnvelopes redEnvelopes) {
		redEnvelopesMapper.insertSelective(redEnvelopes);
	}
	
	public void delRedEnvelopesByUuid(String uuid) {
		redEnvelopesMapper.deleteByPrimaryKey(uuid);
	}
	
	public void updateRedEnvelopes(RedEnvelopes redEnvelopes) {
		redEnvelopesMapper.updateByPrimaryKeySelective(redEnvelopes);
	}
	
	public void updateRedEnvelopesByExample(RedEnvelopes redEnvelopes,RedEnvelopesExample redEnvelopesExample){
	    redEnvelopesMapper.updateByExampleSelective(redEnvelopes,redEnvelopesExample);
	}
	
	public RedEnvelopes getRedEnvelopesByUuid(String uuid) {
		return redEnvelopesMapper.selectByPrimaryKey(uuid);
	}
	
	public List<RedEnvelopes> getPageRedEnvelopes(RedEnvelopesExample redEnvelopesExample) {
		return redEnvelopesMapper.selectPage(redEnvelopesExample);
	}
	
	public int countRedEnvelopes(RedEnvelopesExample redEnvelopesExample) {
		return redEnvelopesMapper.countByExample(redEnvelopesExample);
	}
	
	public List<RedEnvelopes> selectByExample(RedEnvelopesExample example){
	    return redEnvelopesMapper.selectByExample(example);
	}
}
